<?
define('APPGESTBLOCKS','1.10');
/************************************************************************/
/* FrameWork  test preview                                              */
/* ==================================================================== */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
?>

<?php

	/*********************************************
	***** EDITAZIONE DI UN BLOCCO LATERALE *****
	**********************************************/
/*
 * @param   string  $file      nome del file
 * @param   string  $method    metodo di layout del file di configurazione: <by_fields> con textfields, <by_body> con textarea unico
 */
function fncc_editconffile($file,$method){
    if(!file_exists($file)){		// controllo che il file esista prima di fare qualsiasi operazione
	echo "<div align=\"center\"><font color=\"red\"><strong>"._FCC_WARNINGNOMODULE."</strong></font></div>";
    }
    else{
	switch($method){
	    case "by_fields":
	    // il file esiste, diversificazione dei casi in base al metodo di editing
	    ?>
	    <!-- anteprima file da modificare in area di testo readonly -->
	    <strong><?=_FCC_EDITFILESPREVIEW?></strong><br>
	    <?php
	    echo "<textarea readonly cols=\"70\" rows=\"25\">";
	    $fp = @fopen($file, "rb");
	    print htmlentities(fread($fp, filesize($file)));
	    fclose ($fp);
	    echo "</textarea>";
	    ?>
	    <br><br>
	    <!-- lista dei campi da modificare in textfields -->
	    <p><strong><?=_FCC_EDITFILESFIELDS?></strong></p>
	    <form action="index.php?appname=<?=$appname;?>&op=" method="POST">
	    <input type="hidden" name="post_mod" value="<?=$_GET['mod']?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	    <table><tbody>
	    <?php
	    $fg = file($file);
	    $j = 0;
	    // scansione file alla ricerca delle variabili
	    for($i=0;$i<count($fg);$i++){
		if(eregi("^\\\$.",$fg[$i])){				// prende solo le righe che iniziano col carattere "$"
		    $line_tmp = explode(";", $fg[$i]);		// cancella eventuali commenti a dx della variabile
		    $line = explode("=", $line_tmp[0]);		// separa variabile e valorizzazione
		    ?>
		    <tr>
		    <?php
		    ?>
		    <td align="left">
		    <?=$line[0] ?>
		    <INPUT type="hidden" name="conf_field<?=$j?>" value="<?=$line[0]?>">
		    </td>
		    <td>
		    <input type="text" name="conf_value<?=$j?>" size="50" maxlength="1200" value="<?=htmlentities(trim($line[1],"\" "))?>">
		    <input type="hidden" name="conf_value_old<?=$j?>" value="<?=htmlentities(trim($line[1],"\" "))?>">
		    </td>
		    </tr>
		    <?php
		    $j++;
		}
	    }
	    ?>
	    </tbody></table><br>
	    <input type="hidden" name="conf_file" value="<?=$file?>">	<!-- nome file di configurazione da modificare -->
	    <INPUT type="hidden" name="conf_num" value="<?=$j?>">		<!-- numero di campi totali da modificare -->
	    <input type="hidden" name="conf_mod" value="<?=$method?>">	<!-- metodo da utilizzare -->
	    <?php
	    if(is_writeable($file)){						// controllo permessi di scrittura
		?>
		<div align="center"><strong><?=_FCC_WARNINGDOC?></strong><br><br>
		<INPUT type="submit" value="<?=_MODIFICA?>"></div><?
	    }
	    else {
	    ?>
	    <div align="center"><FONT color="red"><strong><?=_FCC_WARNINGRIGHTS?></strong><br><br></FONT></div><? }
	    ?>
	    </form>
	    <?php
	    break;

	    case "by_body":
	    ?>
	    <!-- anteprima file da modificare in area di testo -->
	    <strong><?=_FCC_EDITFILESBODY?></strong><br>
	    <form action="index.php?appname=<?=$appname;?>&op=" method="POST">
	    <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	    <?php
	    echo "<textarea cols=\"70\" rows=\"25\" name=\"conf_body\">";
	    $fp = @fopen($file, "rb");
	    print htmlentities(fread($fp, filesize($file)));
	    fclose ($fp);
	    echo "</textarea>";
	    ?>
	    <br><br>
	    <input type="hidden" name="conf_file" value="<?=$file?>">	<!-- nome file di configurazione da modificare -->
	    <input type="hidden" name="conf_mod" value="<?=$method?>">	<!-- metodo da utilizzare -->
	    <?php
	    if(is_writeable($file)){						// controllo permessi di scrittura
		?><div align="center"><strong><?=_FCC_WARNINGDOC?></strong><br><br>
		<INPUT type="submit" value="<?=_MODIFICA?>"></div><?
	    }
	    else {
		?>
		<div align="center"><FONT color="red"><strong><?=_FCC_WARNINGRIGHTS?></strong><br><br></FONT></div>
		<?php
	    }
	    ?>
	    </form>
	    <?php
	    break;
	}
    }
}

// -------------------------------------------------------------------------------------------------------------
/* selezione metodo elaborazione dati */
switch($_POST['conf_mod']){
	/*******************************************
	***** ORDINAMENTO DEI BLOCCHI LATERALI *****
	********************************************/
	case "ordblock":
	// definizione lingua
	if ($lang==""){
	    include ("applications/".$_POST['post_mod']."/_languages/it.php");
	}
	else{
	    include ("applications/".$_POST['post_mod']."/_languages/$lang.php");
	}
	$n = 0;
	foreach (glob("blocks/".$_POST['ord_blockside']."/*") as $filename){
	    if((fileperms($filename) & 0777) >= 0444){
		if (substr(basename($filename),0,1)=="_"){
		    if($_POST["ord_blockord$n"]=="_"){
			rename($filename, dirname($filename)."/".$_POST["ord_blockord$n"].substr(basename($filename),1));
		    }
		    else{
			rename($filename, dirname($filename)."/".$_POST["ord_blockord$n"]."_".substr(basename($filename),1));
		    }
		}
		else{
		    if (substr(basename($filename),2,1)=="_"){
			if($_POST["ord_blockord$n"]=="_"){
			    rename($filename, dirname($filename)."/".$_POST["ord_blockord$n"].substr(basename($filename),3));
			}
			else{
			    rename($filename, dirname($filename)."/".$_POST["ord_blockord$n"]."_".substr(basename($filename),3));
			}
		    }
		    else{
			rename($filename, dirname($filename)."/".$_POST["ord_blockord$n"]."_".basename($filename));
		    }
		}

	    }
	    else {
		?><script language="javascript">alert('<?=_FCC_WARNINGRIGHTS?>');</script><?php
	    }
	    $n++;
	}
	echo "<meta http-equiv=\"Refresh\" content=\"0; URL=".$siteurl."index.php?appname=$appname\">";
	break;

	/******************************************
	***** CREAZIONE NUOVO BLOCCO LATERALE *****
	*******************************************/
	case "newblock":
	// definizione lingua
	if ($lang=="")
	    include ("applications/".$_POST['post_mod']."/_languages/it.php");
	else
	    include ("applications/".$_POST['post_mod']."/_languages/$lang.php");

	if($_POST['new_blocknum']=="_")
	    $new_block_name = "blocks/".$_POST['new_blockside']."/".$_POST['new_blocknum'].$_POST['new_blockname'].".inc";
	else
	    $new_block_name = "blocks/".$_POST['new_blockside']."/".$_POST['new_blocknum']."_".$_POST['new_blockname'].".inc";

	if(trim($_POST['new_blockname'])!="" AND !file_exists($new_block_name)){
	    $template = "$path/$appname/template/block_template.inc";
	    $fblock = @fopen($new_block_name,"w");
	    $handle = @fopen($template,"r");
	    $contents = fread($handle, filesize($template));
	    fwrite($fblock, $contents);
	    fclose($fblock);
	    ?>
	    <script language="javascript">alert('<?=_FCC_OPZ1DNEWBLOCKOK?>');</script>
	    <?php
	}
	else {
	    ?>
	    <script language="javascript">alert('<?=_FCC_OPZ1DBLOCKEXIST?>');</script>
	    <?
	}
	echo "<meta http-equiv=\"Refresh\" content=\"0; URL=".$siteurl."index.php?appname=$appname\">";
	break;

	/*******************************************
	***** SPOSTAMENTO DEI BLOCCHI LATERALI *****
	********************************************/
	case "moveblock":
	// definizione lingua
	if ($lang=="")
		include ("applications/".$_POST['post_mod']."/_languages/it.php");
	else include ("applications/".$_POST['post_mod']."/_languages/$lang.php");
	if(trim($_POST['move_blockname'])!="" AND (fileperms($_POST['move_blockname']) & 0777) >= 0444 AND !file_exists("blocks/".$_POST['move_blockside']."/".basename($_POST['move_blockname'])))
		{ rename($_POST['move_blockname'], "blocks/".$_POST['move_blockside']."/".basename($_POST['move_blockname']));
		?><script language="javascript">alert('<?=_FCC_OPZ1DMOVEBLOCKOK?>');</script><?
		}
	else { ?><script language="javascript">alert('<?=_FCC_OPZ1DBLOCKEXIST?>');</script><? }
	echo "<meta http-equiv=\"Refresh\" content=\"0; URL=".$siteurl."index.php?appname=$appname\">";
	break;

	/*****************************************
	***** RINOMINA DI UN BLOCCO LATERALE *****
	******************************************/
	case "renameblock":
	// definizione lingua
	if ($lang=="")
		include ("applications/".$_POST['post_mod']."/_languages/it.php");
	else include ("applications/".$_POST['post_mod']."/_languages/$lang.php");
	if(trim($_POST['renblockname_new'])!="" AND (fileperms($_POST['renblockname_old']) & 0777) >= 0444 AND !eregi($_POST['renblockname_new'].".inc",$_POST['renblockname_old']))
		{ rename($_POST['renblockname_old'], str_replace(str_replace(".inc","",substr($_POST['renblockname_old'],strpos($_POST['renblockname_old'],'_')+1)),$_POST['renblockname_new'],$_POST['renblockname_old']));
		?><script language="javascript">alert('<?=_FCC_OPZ1DRENBLOCKOK?>');</script><?
		}
	else { ?><script language="javascript">alert('<?=_FCC_OPZ1DBLOCKEXIST?>');</script><? }
	echo "<meta http-equiv=\"Refresh\" content=\"0; URL=".$siteurl."index.php?appname=$appname\">";
	break;

	/*********************************************
	***** ELIMINAZIONE DI UN BLOCCO LATERALE *****
	**********************************************/
	case "delblock":
	// definizione lingua
	if ($lang=="")
	    include ("applications/".$_POST['post_mod']."/_languages/it.php");
	else
	    include ("applications/".$_POST['post_mod']."/_languages/$lang.php");
	if(trim($_POST['del_blockname'])!="" AND is_writeable($_POST['del_blockname'])){
	    unlink($_POST['del_blockname']);
	    ?><script language="javascript">alert('<?=_FCC_OPZ1DDELBLOCKOK?>');</script><?
	}
	else {
	    ?>
	    <script language="javascript">alert('<?=_FCC_OPZ1DBLOCKUNWR?>');</script>
	    <?
	}
	echo "<meta http-equiv=\"Refresh\" content=\"0; URL=".$siteurl."index.php?appname=$appname\">";
	break;
    }




// -------------------------------------------------------------------------------------------------------------
# definizione lingua
if ($lang=="")
    include ("applications/$appname/_languages/it.php");
else
    include ("applications/$appname/_languages/$lang.php");

/*
 * Visualizza la maschera di gestione dei blocchi laterali di FlatNuke
 */
function fncc_blocks($appname, $subapp, $path)
	{ #$t1 = fncc_getmicrotime(); // TEST BENCHMARK
	global $bgcolor1;
	// array blocchi sx con percorso assoluto (es: /blocks/dx/02_Login.php)
	$i = 0;
	foreach (glob("blocks/left/*") as $filename){
	    $arrsx_filefull[$i] = $filename;
	    $i++;
	}
	#print_r($arrsx_filefull); print(count($arrsx_filefull)); // TEST

	// array blocchi dx con percorso assoluto (es: /blocks/dx/02_Login.php)
	$i = 0;
	foreach (glob("blocks/right/*") as $filename){
	    $arrdx_filefull[$i] = $filename;
	    $i++;
	}

	// array blocchi sx con posizione e nome assoluto (es: 02 - Login)
	for($i=0;$i<count($arrsx_filefull);$i++){
	    // posizione
	    if (substr(basename($arrsx_filefull[$i]),0,1)=="_"){
		$arrsx_fileord[0][$i] ="_";
	    }
	    else{
		    $arrsx_fileord[0][$i] = substr(basename($arrsx_filefull[$i]),0,strpos(basename($arrsx_filefull[$i]),'_'));
	    }
	    //nome
	    $arrsx_fileord[1][$i]=str_replace(".inc","",basename($arrsx_filefull[$i]));
	    if(substr($arrsx_fileord[1][$i],2,1)=="_"){
		$arrsx_fileord[1][$i] = substr($arrsx_fileord[1][$i],3);
	    }
	    if(substr($arrsx_fileord[1][$i],0,1)=="_"){
		$arrsx_fileord[1][$i] = substr($arrsx_fileord[1][$i],1);
	    }

	}
	#echo "<br>"; print_r($arrsx_fileord); // TEST

	// array blocchi dx con posizione e nome assoluto (es: 02 - Login)
	for($i=0;$i<count($arrdx_filefull);$i++){

	    // posizione
	    if (substr(basename($arrdx_filefull[$i]),0,1)=="_"){
		$arrdx_fileord[0][$i] ="_";
	    }
	    else{
		$arrdx_fileord[0][$i] = substr(basename($arrdx_filefull[$i]),0,strpos(basename($arrdx_filefull[$i]),'_'));
	    }
	    //nome
	    $arrdx_fileord[1][$i]=str_replace(".inc","",basename($arrdx_filefull[$i]));
	    if(substr($arrdx_fileord[1][$i],2,1)=="_"){
		$arrdx_fileord[1][$i] = substr($arrdx_fileord[1][$i],3);
	    }
	    if(substr($arrdx_fileord[1][$i],0,1)=="_"){
		$arrdx_fileord[1][$i] = substr($arrdx_fileord[1][$i],1);
	    }

	}

	?>
	<tr><td><?=_FCC_OPZ1DTITOLO?></td></tr>
	<tr><td bgcolor="<?=$bgcolor1?>" align="center"><br><img src="applications/<?=$appname;?>/images/kcmdf.png" alt="blocks" border="0"></td></tr>
	<tr><td align="center" bgcolor="<?=$bgcolor1?>"><br><?=_FCC_OPZ1DEXPLODE?></td></tr>
	<tr><td bgcolor="<?=$bgcolor1?>">

	<!-- ******* riordina blocchi ******* -->
	  <br><hr>
	  <img src="applications/<?=$appname;?>/images/vcs_update.png" alt="ord_block" align="middle" border="0"> <b><?=_FCC_OPZ1DORDBLOCK?></b>
	  <form action="index.php?appname=<?=$appname;?>&op=ordblock" method="POST">
	  <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  <input type="hidden" name="conf_mod" value="ordblock">		<!-- metodo da utilizzare -->
	  <input type="hidden" name="ord_blockside" value="left">			<!-- lato dei blocchi -->
	  <blockquote><table><tbody><tr valign="top">
	  <td width="45%">
	  <table><tbody>
	  <tr><td rowSpan="1" colspan="2" align="center"><?=_FCC_OPZ1DLEFT?></td></tr>
	  <? for($n=0;$n<count($arrsx_filefull);$n++)
	  	{ ?>
	  	<tr><td>
	  	<select name="ord_blockord<?=$n?>">				<!-- nuovo ordine -->
	  	<? if(substr($arrsx_fileord[0][$n],0,2) == "_")
			echo "<option value=\"_\">"._FCC_OPZ1DHIDDEN."</option>";
		else echo "<option value=\"".$arrsx_fileord[0][$n]."\">".$arrsx_fileord[0][$n]."</option>";
		?>
	  	<option value="_"><?=_FCC_OPZ1DHIDDEN?></option>
	  	<? for($i=0;$i<=15;$i++)
	  		{ if($i<10) echo "<option value=\"0$i\">0$i</option>";
	  		else echo "<option value=\"$i\">$i</option>";
	  		} ?>
	  	</select>
		&nbsp;
		<?=$arrsx_fileord[1][$n]?>
	  	</td></tr>
	  	<? }
	  	if(is_writeable("blocks/left"))	// controllo permessi di scrittura
	  		{ ?><tr><td rowSpan="1" colspan="2" align="center"><br><input type="submit"></form></td></tr><?
	  		}
	  	else { ?><tr><td rowSpan="1" colspan="2" align="center"><br><FONT color="red"><b><?=_FCC_WARNINGDIRNOTWR?></b></FONT></form></td></tr><? }?>
	  </tbody></table>
	  </td>
	  <td width="10%"></td>
	  <td width="45%">
	  <form action="index.php?appname=<?=$appname;?>&op=ordblock" method="POST">
	  <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  <input type="hidden" name="conf_mod" value="ordblock">		<!-- metodo da utilizzare -->
	  <input type="hidden" name="ord_blockside" value="right">			<!-- lato dei blocchi -->
	  <table><tbody>
	  <tr><td rowSpan="1" colspan="2" align="center"><?=_FCC_OPZ1DRIGHT?></td></tr>
	  <? for($n=0;$n<count($arrdx_filefull);$n++)
	  	{ ?>
	  	<tr align="right"><td><?=$arrdx_fileord[1][$n]?>&nbsp;
	  	<select name="ord_blockord<?=$n?>">				<!-- nuovo ordine -->
	  	<? if(substr($arrdx_fileord[0][$n],0,2) == "_")
			echo "<option value=\"_\">"._FCC_OPZ1DHIDDEN."</option>";
		else echo "<option value=\"".$arrdx_fileord[0][$n]."\">".$arrdx_fileord[0][$n]."</option>";
		?>
	  	<option value="_"><?=_FCC_OPZ1DHIDDEN?></option>
	  	<? for($i=0;$i<=15;$i++)
	  		{ if($i<10) echo "<option value=\"0$i\">0$i</option>";
	  		else echo "<option value=\"$i\">$i</option>";
	  		} ?>
	  	</select>
	  	</td></tr>
	  	<? }
	  	if(is_writeable("blocks/right"))	// controllo permessi di scrittura
	  		{ ?><tr><td rowSpan="1" colspan="2" align="center"><br><input type="submit"></form></td></tr><?
	  		}
	  	else { ?><tr><td rowSpan="1" colspan="2" align="center"><br><FONT color="red"><b><?=_FCC_WARNINGDIRNOTWR?></b></FONT></form></td></tr><? }?>
	  </tbody></table>
	  </td>
	  </tr></tbody></table></blockquote>

	<!-- ******* creazione nuovo blocco ******* -->
	  <hr size="1" noshade>
	  <img src="applications/<?=$appname;?>/images/vcs_add.png" alt="add_block" align="middle" border="0"> <b><?=_FCC_OPZ1DNEWBLOCK?></b>
	  <form action="index.php?appname=<?=$appname;?>&op=newblock" method="POST">
	  <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  <input type="hidden" name="conf_mod" value="newblock">		<!-- metodo da utilizzare -->
	  <blockquote><table><tbody>
	  <tr><td align="right"><input type="text" name="new_blockname" size="11" maxlength="20"></td><td><?=_FCC_OPZ1DNEWBLOCKNAME?></td></tr>
	  <tr><td align="right"><select name="new_blocknum">
	  <option value="_"><?=_FCC_OPZ1DHIDDEN?></option>
	  <? for($i=1;$i<=15;$i++)
	  	{ if($i<10) echo "<option value=\"0$i\">0$i</option>";
	  	else echo "<option value=\"$i\">$i</option>";
	  	} ?>
	  </select></td><td><?=_FCC_OPZ1DNEWBLOCKNUM?></td></tr>
	  <tr><td align="right"><select name="new_blockside">
	  	<option value="left"><?=_FCC_OPZ1DLEFT?></option>
	  	<option value="right"><?=_FCC_OPZ1DRIGHT?></option>
	  </select></td><td><?=_FCC_OPZ1DNEWBLOCKSIDE?></td></tr>
	  </tbody></table></blockquote>
	  <? if(is_writeable("blocks/left") AND is_writeable("blocks/right"))	// controllo permessi di scrittura
	  	{ ?><div align="center"><input type="submit"></div><?
	  	}
	  else { ?><div align="center"><FONT color="red"><strong><?=_FCC_WARNINGDIRNOTWR?></strong></FONT></div><? } ?>
	  </form>
	<!-- ******* spostamento blocco ******* -->
	  <hr size="1" noshade>
	  <img src="applications/<?=$appname;?>/images/vcs_move.png" alt="move_block" align="middle" border="0"> <b><?=_FCC_OPZ1DMOVEBLOCK?></b>
	  <form action="index.php?appname=<?=$appname;?>&op=moveblock" method="POST">
	  <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  <input type="hidden" name="conf_mod" value="moveblock">		<!-- metodo da utilizzare -->
	  <input type="hidden" name="move_blockside" value="right">		<!-- lato di destinazione dei blocchi -->
	  <blockquote><table><tbody>
	  <tr><td><?=_FCC_OPZ1DMOVEBLOCKLR?></td>
	  <td align="right"><select name="move_blockname">
	  	<option></option>
	  	<? for($n=0;$n<count($arrsx_filefull);$n++)
	  		echo "<option value=\"".$arrsx_filefull[$n]."\">".$arrsx_fileord[1][$n]."</option>";
	  	?>
	  </select></td>
	  <? if(is_writeable("blocks/left"))					// controllo permessi di scrittura
	  	{ ?><td><input type="submit"></form></td><?
	  	}
	  else { ?><td><FONT color="red"><strong><?=_FCC_WARNINGDIRNOTWR?></strong></FONT></form></td><? } ?>
	  </tr>
	  <tr><td align="right"><?=_FCC_OPZ1DMOVEBLOCKRL?></td>
	  <form action="index.php?appname=<?=$appname;?>&op=moveblock" method="POST">
	  <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  <input type="hidden" name="conf_mod" value="moveblock">		<!-- metodo da utilizzare -->
	  <input type="hidden" name="move_blockside" value="left">		<!-- lato di destinazione dei blocchi -->
	  <td><select name="move_blockname">
	  	<option></option>
	  	<? for($n=0;$n<count($arrdx_filefull);$n++)
	  		echo "<option value=\"".$arrdx_filefull[$n]."\">".$arrdx_fileord[1][$n]."</option>";
	  	?>
	  </select></td>
	  <? if(is_writeable("blocks/right"))					// controllo permessi di scrittura
	  	{ ?><td><input type="submit"></form></td><?
	  	}
	  else { ?><td><FONT color="red"><strong><?=_FCC_WARNINGDIRNOTWR?></strong></FONT></form></td><? } ?>
	  </tr></tbody></table></blockquote>
	<!-- ******* modifica blocco ******* -->
	  <hr size="1" noshade>
	  <img src="applications/<?=$appname;?>/images/vcs_edit.png" alt="edit_block" align="middle" border="0"> <b><?=_FCC_OPZ1DMODBLOCK?></b>
	  <form action="index.php?appname=<?=$appname;?>&amp;target=<?=$_GET['target']?>" method="POST">
	  <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  <blockquote><table><tbody>
	  <tr><td><?=_FCC_OPZ1DLEFT?></td>
	  <td align="right"><select name="edit_blockname">
	  	<option></option>
	  	<? for($n=0;$n<count($arrsx_filefull);$n++)
	  		echo "<option value=\"".$arrsx_filefull[$n]."\">".$arrsx_fileord[1][$n]."</option>";
	  	?>
	  </select></td>
	  <td align="right">
	  	<input type="radio" name="edit_blockmod" value="<?=_FCC_OPZ1DMODRENAME?>" checked><?=_FCC_OPZ1DMODRENAME?></input>
	  	<input type="radio" name="edit_blockmod" value="<?=_FCC_OPZ1DMODEDIT?>"><?=_FCC_OPZ1DMODEDIT?></input>
	  </td>
	  <? if(is_writeable("blocks/left"))					// controllo permessi di scrittura
	  	{ ?><td><input type="submit"></form></td><?
	  	}
	  else { ?><td><FONT color="red"><strong><?=_FCC_WARNINGDIRNOTWR?></strong></FONT></form></td><? } ?>
	  </tr>
	  <tr><td align="right"><?=_FCC_OPZ1DRIGHT?></td>
	  <form action="index.php?appname=<?=$appname;?>&amp;target=<?=$_GET['target']?>" method="POST">
	  <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  <td align="right"><select name="edit_blockname">
	  	<option></option>
	  	<? for($n=0;$n<count($arrdx_filefull);$n++)
	  		echo "<option value=\"".$arrdx_filefull[$n]."\">".$arrdx_fileord[1][$n]."</option>";
	  	?>
	  </select></td>
	  <td align="right">
	  	<input type="radio" name="edit_blockmod" value="<?=_FCC_OPZ1DMODRENAME?>" checked><?=_FCC_OPZ1DMODRENAME?></input>
	  	<input type="radio" name="edit_blockmod" value="<?=_FCC_OPZ1DMODEDIT?>"><?=_FCC_OPZ1DMODEDIT?></input>
	  </td>
	  <? if(is_writeable("blocks/right"))					// controllo permessi di scrittura
	  	{ ?><td><input type="submit"></form></td><?
	  	}
	  else { ?><td><FONT color="red"><strong><?=_FCC_WARNINGDIRNOTWR?></strong></FONT></form></td><? } ?>
	  </tr></tbody></table></blockquote>
	  <? if(isset($_POST['edit_blockmod']))
	  { if($_POST['edit_blockmod']==_FCC_OPZ1DMODEDIT AND trim($_POST['edit_blockname'])!="")
	  	{ ?><table><tbody><tr><td><?= fncc_editconffile($_POST['edit_blockname'],"by_body"); ?></td></tr></tbody></table><?
	  	}
	  else if($_POST['edit_blockmod']==_FCC_OPZ1DMODRENAME AND trim($_POST['edit_blockname'])!="")
	  	{ ?><table><tbody><tr><td><form action="index.php?appname=<?=$appname;?>&op=renameblock" method="POST">
	  	<input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  	<input type="hidden" name="conf_mod" value="renameblock">	<!-- metodo da utilizzare -->
		<input type="hidden" name="renblockname_old" value="<?=$_POST['edit_blockname']?>">
	  	<?=_FCC_OPZ1DMODRENAMENEW?> "<?=str_replace(".php","",substr($_POST['edit_blockname'],strpos($_POST['edit_blockname'],'_')+1))?>":&nbsp;
		<input type="text" name="renblockname_new" value="<?=str_replace(".php","",substr($_POST['edit_blockname'],strpos($_POST['edit_blockname'],'_')+1))?>" size="20" maxlength="20">
	  	&nbsp;<input type="submit">
	  	</form></td></tr></tbody></table><?
	  	}
	  }
	  ?>
	<!-- ******* eliminazione blocco ******* -->
	  <hr size="1" noshade>
	  <img src="applications/<?=$appname;?>/images/vcs_remove.png" alt="del_block" align="middle" border="0"> <b><?=_FCC_OPZ1DDELBLOCK?></b>
	  <form action="index.php?appname=<?=$appname;?>&op=delblock" method="POST">
	  <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  <input type="hidden" name="conf_mod" value="delblock">		<!-- metodo da utilizzare -->
	  <blockquote><table><tbody>
	  <tr><td><?=_FCC_OPZ1DLEFT?></td>
	  <td align="right"><select name="del_blockname">
	  	<option></option>
	  	<? for($n=0;$n<count($arrsx_filefull);$n++)
	  		echo "<option value=\"".$arrsx_filefull[$n]."\">".$arrsx_fileord[1][$n]."</option>";
	  	?>
	  </select></td>
	  <? if(is_writeable("blocks/left"))					// controllo permessi di scrittura
	  	{ ?><td><input type="submit"></form></td><?
	  	}
	  else { ?><td><FONT color="red"><strong><?=_FCC_WARNINGDIRNOTWR?></strong></FONT></form></td><? } ?>
	  </tr>
	  <tr><td align="right"><?=_FCC_OPZ1DRIGHT?></td>
	  <form action="index.php?appname=<?=$appname;?>&op=delblock" method="POST">
	  <input type="hidden" name="post_mod" value="<?=$appname;?>"><input type="hidden" name="post_target" value="<?=$_GET['target']?>">
	  <input type="hidden" name="conf_mod" value="delblock">		<!-- metodo da utilizzare -->
	  <td><select name="del_blockname">
	  	<option></option>
	  	<? for($n=0;$n<count($arrdx_filefull);$n++)
	  		echo "<option value=\"".$arrdx_filefull[$n]."\">".$arrdx_fileord[1][$n]."</option>";
	  	?>
	  </select></td>
	  <? if(is_writeable("blocks/right"))					// controllo permessi di scrittura
	  	{ ?><td><input type="submit"></form></td><?
	  	}
	  else { ?><td><FONT color="red"><strong><?=_FCC_WARNINGDIRNOTWR?></strong></FONT></form></td><? } ?>
	  </tr></tbody></table></blockquote>
	  <hr>
	  <? #$t2 = fncc_getmicrotime(); echo abs($t2-$t1)." secondi"; // TEST BENCHMARK ?>
	</td></tr>
	<?
	}

if (admin_isadmin()) {
fncc_blocks($appname, $subapp,$path);
}


?>


